<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <base href="${basePath }"/>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link href="3rd/ligerui/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css"/>
    <script src="3rd/ligerui/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
    <script src="3rd/ligerui/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
    <script src="3rd/ligerui/jquery-validation/jquery.validate.min.js" type="text/javascript"></script>
    <script src="3rd/ligerui/jquery-validation/jquery.metadata.js" type="text/javascript"></script>
    <script src="3rd/ligerui/jquery-validation/messages_cn.js" type="text/javascript"></script>
    <script src="3rd/kindeditor-4.1.1/kindeditor-min.js" type="text/javascript" charset="utf-8"></script>
    <script src="3rd/kindeditor-4.1.1/lang/zh_CN.js" type="text/javascript" charset="utf-8"></script>
    <script src="3rd/jscolor/jscolor.js" type="text/javascript"></script>

    <script type="text/javascript">
        var eee;
        $(function () {
            $("#publist").ligerDateEditor({ showTime: true});

            $.metadata.setType("attr", "validate");
            var v = $("form").validate({
                debug: true,
                errorPlacement: function (lable, element) {
                    if (element.hasClass("l-textarea")) {
                        element.ligerTip({ content: lable.html(), target: element[0] });
                    }
                    else if (element.hasClass("l-text-field")) {
                        element.parent().ligerTip({ content: lable.html(), target: element[0] });
                    }
                    else {
                        lable.appendTo(element.parents("td:first").next("td"));
                    }
                },
                success: function (lable) {
                    lable.ligerHideTip();
                    lable.remove();
                },
                submitHandler: function () {
                    $("form .l-text,.l-textarea").ligerHideTip();
                    //提交form
                    $('#saveButton').attr('disabled', 'disabled');
                    $("#form1")[0].submit();
                }
            });
            $("form").ligerForm();
            $(".l-button-test").click(function () {
                alert(v.element($("#txtName")));
            });
        });
    </script>
    <style type="text/css">
        body {
            font-size: 12px;
        }

        .l-table-edit {
        }

        .l-table-edit-td {
            padding: 4px;
        }

        .l-button-submit, .l-button-test {
            width: 80px;
            float: left;
            margin-left: 10px;
            padding-bottom: 2px;
        }

        .l-verify-tip {
            left: 230px;
            top: 120px;
        }
    </style>

</head>

<body style="padding:10px">

<form name="form1" method="post" action="/picture/save.shtml" id="form1" enctype="multipart/form-data">
    <div>
    </div>
    <table cellpadding="0" cellspacing="0" class="l-table-edit">
        <tr style="line-height: 30px;">
            <td align="right" class="l-table-edit-td">所属模型:&nbsp;</td>
            <td align="left" class="l-table-edit-td">
                图片模型
                <input type="hidden" value="P" name="type"/>
            </td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td" valign="top">标题:</td>
            <td align="left" class="l-table-edit-td">
                <input name="title" type="text" id="title" ltype="text" validate="{required:true}"
                       value="${data.title}"/>
            </td>
            <td align="left"></td>
        </tr>

        <tr>
            <td align="right" class="l-table-edit-td">简略标题:</td>
            <td align="left" class="l-table-edit-td">
                <textarea cols="100" rows="4" class="l-textarea" id="briefTitle" name="briefTitle"
                          style="width:400px">${data.briefTitle}</textarea>
            </td>
            <td align="left"></td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td">标题颜色:</td>
            <td align="left" class="l-table-edit-td">
                <input name="titleColor" id="titleColor" class="color" value="000000">
            </td>
            <td align="left"></td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td">标题属性:</td>
            <td align="left" class="l-table-edit-td">
                <input id="titleStyle" type="checkbox" value="bold" name="titleStyle"
                       <c:if test="${data.titleStyle=='bold'}">checked="checked"</c:if>/><label
                    for="titleStyle">加粗</label><br/>
            </td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td">作者:</td>
            <td align="left" class="l-table-edit-td">
                <input name="author" type="text" id="author" ltype="text" validate="{required:true}"
                       value="${data.author}"/>
            </td>
            <td align="left"></td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td">来源:</td>
            <td align="left" class="l-table-edit-td">
                <input name="source" type="text" id="source" ltype="text" value="${data.source}"/>
            </td>
            <td align="left"></td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td" valign="top">排序:</td>
            <td align="left" class="l-table-edit-td">
                <input name="sort" type="text" id="sort" validate="{digits:true,min:0}" ltype="text" value="0"/>
            </td>
            <td align="left"></td>
        </tr>
        <tr style="line-height: 30px;">
            <td align="right" class="l-table-edit-td">栏目:&nbsp;</td>
            <td align="left" class="l-table-edit-td">
                <select name="partId" id="partId">
                    <option value="">请选择</option>
                    <c:forEach items="${parts}" var="entry">
                        <option value="${entry.key}"
                                <c:if test="${entry.key eq data.partId}">selected="selected" </c:if> >${entry.value}</option>
                    </c:forEach>
                </select>
            </td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td">摘要 :</td>
            <td align="left" class="l-table-edit-td">
                <textarea cols="100" rows="4" class="l-textarea" id="summary" name="summary"
                          style="width:400px">${data.summary}</textarea>
            </td>
            <td align="left"></td>
        </tr>
        <tr style="line-height: 30px;">
            <td align="right" class="l-table-edit-td">发布时间:</td>
            <td align="left" class="l-table-edit-td">
                <input type="text" name="publist" id="publist" value="${data.publist}"/>
            </td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td">跳转网址:</td>
            <td align="left" class="l-table-edit-td">
                <input name="clickGoUrl" type="text" id="clickGoUrl" ltype="text" value="${data.clickGoUrl}"/>
            </td>
            <td align="left"></td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td">缩略图:</td>
            <td align="left" class="l-table-edit-td">
                <input name="thumbPicFile" type="file" id="thumbPicFile" ltype="file"/>
            </td>
            <td align="left"></td>
        </tr>
        <tr>
            <td align="right" class="l-table-edit-td">图片:</td>
            <td align="left" class="l-table-edit-td">
                <input name="picFile" type="file" id="picFile" ltype="file"/>
            </td>
            <td align="left"></td>
        </tr>
    </table>
    <br/>
    <input type="submit" value="保存" id="saveButton" name="saveButton" class="l-button l-button-submit"/>
</form>
<div style="display:none">
</div>
</body>
</html>